home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW etc / MPW-GM / MPW / Examples / CExamples / TESample.r < prev    next >
Encoding:
Text File  |  1998-12-03  |  7.7 KB  |  341 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware TextEdit Sample Application
  6. #
  7. #    TESample
  8. #
  9. #    TESample.r    -    Rez Source
  10. #
  11. #    Copyright © 1989, 1998 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:    
  15. #                1.00                08/88
  16. #                1.01                11/88
  17. #                1.02                04/89
  18. #                1.03                06/89
  19. #                1.04                06/98    compatible with 3.1 interfaces
  20. #
  21. #    Components:
  22. #                TESample.c            Feb.  1, 1990
  23. #                TESampleGlue.a        Feb.  1, 1990
  24. #                TESample.r            Feb.  1, 1990
  25. #                TESample.h            Feb.  1, 1990
  26. #                TESample.make        Feb.  1, 1990
  27. #
  28. #    TESample is an example application that demonstrates how 
  29. #    to initialize the commonly used toolbox managers, operate 
  30. #    successfully under MultiFinder, handle desk accessories and 
  31. #    create, grow, and zoom windows. The fundamental TextEdit 
  32. #    toolbox calls and TextEdit autoscroll are demonstrated. It 
  33. #    also shows how to create and maintain scrollbar controls.
  34. #
  35. #    It does not by any means demonstrate all the techniques you 
  36. #    need for a large application. In particular, Sample does not 
  37. #    cover exception handling, multiple windows/documents, 
  38. #    sophisticated memory management, printing, or undo. All of 
  39. #    these are vital parts of a normal full-sized application.
  40. #
  41. #    This application is an example of the form of a Macintosh 
  42. #    application; it is NOT a template. It is NOT intended to be 
  43. #    used as a foundation for the next world-class, best-selling, 
  44. #    600K application. A stick figure drawing of the human body may 
  45. #    be a good example of the form for a painting, but that does not 
  46. #    mean it should be used as the basis for the next Mona Lisa.
  47. #
  48. #    We recommend that you review this program or Sample before 
  49. #    beginning a new application. Sample is a simple app. which doesn’t 
  50. #    use TextEdit or the Control Manager.
  51. #
  52. ------------------------------------------------------------------------------*/
  53.  
  54. #include "systypes.r"
  55. #include "types.r"
  56.  
  57. #include "TESample.h"
  58.  
  59. resource 'vers' (1) {
  60.     0x02, 0x00, release, 0x00,
  61.     verUS,
  62.     "1.02",
  63.     "1.02, Copyright \251 1989 Apple Computer, Inc."
  64. };
  65.  
  66. /* we use an MBAR resource to conveniently load all the menus */
  67.  
  68. resource 'MBAR' (rMenuBar, preload) {
  69.     { mApple, mFile, mEdit };        /* three menus */
  70. };
  71.  
  72.  
  73. resource 'MENU' (mApple, preload) {
  74.     mApple, textMenuProc,
  75.     0b1111111111111111111111111111101,    /* disable dashed line, enable About and DAs */
  76.     enabled, apple,
  77.     {
  78.         "About TESample\311",
  79.             noicon, nokey, nomark, plain;
  80.         "-",
  81.             noicon, nokey, nomark, plain
  82.     }
  83. };
  84.  
  85. resource 'MENU' (mFile, preload) {
  86.     mFile, textMenuProc,
  87.     0b0000000000000000000100000000000,    /* enable Quit only, program enables others */
  88.     enabled, "File",
  89.     {
  90.         "New",
  91.             noicon, "N", nomark, plain;
  92.         "Open",
  93.             noicon, "O", nomark, plain;
  94.         "-",
  95.             noicon, nokey, nomark, plain;
  96.         "Close",
  97.             noicon, "W", nomark, plain;
  98.         "Save",
  99.             noicon, "S", nomark, plain;
  100.         "Save As\311",
  101.             noicon, nokey, nomark, plain;
  102.         "Revert",
  103.             noicon, nokey, nomark, plain;
  104.         "-",
  105.             noicon, nokey, nomark, plain;
  106.         "Page Setup\311",
  107.             noicon, nokey, nomark, plain;
  108.         "Print\311",
  109.             noicon, nokey, nomark, plain;
  110.         "-",
  111.             noicon, nokey, nomark, plain;
  112.         "Quit",
  113.             noicon, "Q", nomark, plain
  114.     }
  115. };
  116.  
  117. resource 'MENU' (mEdit, preload) {
  118.     mEdit, textMenuProc,
  119.     0b0000000000000000000000000000000,    /* disable everything, program does the enabling */
  120.     enabled, "Edit",
  121.      {
  122.         "Undo",
  123.             noicon, "Z", nomark, plain;
  124.         "-",
  125.             noicon, nokey, nomark, plain;
  126.         "Cut",
  127.             noicon, "X", nomark, plain;
  128.         "Copy",
  129.             noicon, "C", nomark, plain;
  130.         "Paste",
  131.             noicon, "V", nomark, plain;
  132.         "Clear",
  133.             noicon, nokey, nomark, plain
  134.     }
  135. };
  136.  
  137.  
  138. /* this ALRT and DITL are used as an About screen */
  139.  
  140. resource 'ALRT' (rAboutAlert, purgeable) {
  141.     {40, 20, 160, 296}, rAboutAlert, {
  142.         OK, visible, silent;
  143.         OK, visible, silent;
  144.         OK, visible, silent;
  145.         OK, visible, silent
  146.     },
  147.     centerMainScreen
  148. };
  149.  
  150. resource 'DITL' (rAboutAlert, purgeable) {
  151.     { /* array DITLarray: 5 elements */
  152.         /* [1] */
  153.         {88, 184, 108, 264},
  154.         Button {
  155.             enabled,
  156.             "OK"
  157.         },
  158.         /* [2] */
  159.         {8, 8, 24, 274},
  160.         StaticText {
  161.             disabled,
  162.             "MultiFinder-Aware TextEdit Application"
  163.         },
  164.         /* [3] */
  165.         {32, 8, 48, 237},
  166.         StaticText {
  167.             disabled,
  168.             "Copyright \251 1989 Apple Computer"
  169.         },
  170.         /* [4] */
  171.         {56, 8, 72, 136},
  172.         StaticText {
  173.             disabled,
  174.             "Brought to you by:"
  175.         },
  176.         /* [5] */
  177.         {80, 24, 112, 167},
  178.         StaticText {
  179.             disabled,
  180.             "Macintosh Developer  Technical Support"
  181.         }
  182.     }
  183. };
  184.  
  185.  
  186. /* this ALRT and DITL are used as an error screen */
  187.  
  188. resource 'ALRT' (rUserAlert, purgeable) {
  189.     {40, 20, 150, 260},
  190.     rUserAlert,
  191.     { /* array: 4 elements */
  192.         /* [1] */
  193.         OK, visible, silent,
  194.         /* [2] */
  195.         OK, visible, silent,
  196.         /* [3] */
  197.         OK, visible, silent,
  198.         /* [4] */
  199.         OK, visible, silent
  200.     },
  201.     centerMainScreen
  202. };
  203.  
  204.  
  205. resource 'DITL' (rUserAlert, purgeable) {
  206.     { /* array DITLarray: 3 elements */
  207.         /* [1] */
  208.         {80, 150, 100, 230},
  209.         Button {
  210.             enabled,
  211.             "OK"
  212.         },
  213.         /* [2] */
  214.         {10, 60, 60, 230},
  215.         StaticText {
  216.             disabled,
  217.             "Error. ^0."
  218.         },
  219.         /* [3] */
  220.         {8, 8, 40, 40},
  221.         Icon {
  222.             disabled,
  223.             2
  224.         }
  225.     }
  226. };
  227.  
  228.  
  229. resource 'WIND' (rDocWindow, preload, purgeable) {
  230.     {64, 60, 314, 460},
  231.     zoomDocProc, invisible, goAway, 0x0, "untitled", noAutoCenter
  232. };
  233.  
  234.  
  235. resource 'CNTL' (rVScroll, preload, purgeable) {
  236.     {-1, 385, 236, 401},
  237.     0, visible, 0, 0, scrollBarProc, 0, ""
  238. };
  239.  
  240.  
  241. resource 'CNTL' (rHScroll, preload, purgeable) {
  242.     {235, -1, 251, 386},
  243.     0, visible, 0, 0, scrollBarProc, 0, ""
  244. };
  245.  
  246. resource 'STR#' (kErrStrings, purgeable) {
  247.     {
  248.     "You must run on 512Ke or later";
  249.     "Application Memory Size is too small";
  250.     "Not enough memory to run TESample";
  251.     "Not enough memory to do Cut";
  252.     "Cannot do Cut";
  253.     "Cannot do Copy";
  254.     "Cannot exceed 32,000 characters with Paste";
  255.     "Not enough memory to do Paste";
  256.     "Cannot create window";
  257.     "Cannot exceed 32,000 characters";
  258.     "Cannot do Paste"
  259.     }
  260. };
  261.  
  262. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  263.  
  264. resource 'SIZE' (-1) {
  265.     dontSaveScreen,
  266.     acceptSuspendResumeEvents,
  267.     enableOptionSwitch,
  268.     canBackground,                /* we can background; we don't currently, but our sleep value */
  269.                                 /* guarantees we don't hog the Mac while we are in the background */
  270.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  271.     backgroundAndForeground,    /* this is definitely not a background-only application! */
  272.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  273.     ignoreChildDiedEvents,        /* essentially, I'm not a debugger (sub-launching) */
  274.     not32BitCompatible,            /* this app should not be run in 32-bit address space */
  275.     reserved,
  276.     reserved,
  277.     reserved,
  278.     reserved,
  279.     reserved,
  280.     reserved,
  281.     reserved,
  282.     kPrefSize * 1024,
  283.     kMinSize * 1024    
  284. };
  285.  
  286.  
  287. type 'MOOT' as 'STR ';
  288.  
  289.  
  290. resource 'MOOT' (0) {
  291.     "MultiFinder-Aware TextEdit Sample Application"
  292. };
  293.  
  294.  
  295. resource 'BNDL' (128) {
  296.     'MOOT',
  297.     0,
  298.     {
  299.         'ICN#',
  300.         {
  301.             0, 128
  302.         },
  303.         'FREF',
  304.         {
  305.             0, 128
  306.         }
  307.     }
  308. };
  309.  
  310.  
  311. resource 'FREF' (128) {
  312.     'APPL',
  313.     0,
  314.     ""
  315. };
  316.  
  317.  
  318. resource 'ICN#' (128) {
  319.     { /* array: 2 elements */
  320.         /* [1] */
  321.         $"04 30 40 00 0A 50 A0 00 0B 91 10 02 08 22 08 03"
  322.         $"12 24 04 05 20 28 02 09 40 10 01 11 80 0C 00 A1"
  323.         $"80 03 FF C2 7E 00 FF 04 01 00 7F 04 03 00 1E 08"
  324.         $"04 E0 00 0C 08 E0 00 0A 10 E0 00 09 08 C0 00 06"
  325.         $"04 87 FE 04 02 88 01 04 01 88 00 84 00 88 00 44"
  326.         $"00 88 00 44 00 88 00 C4 01 10 01 88 02 28 03 10"
  327.         $"01 C4 04 E0 00 02 08 00 73 BF FB EE 4C A2 8A 2A"
  328.         $"40 AA AA EA 52 AA AA 24 5E A2 8A EA 73 BE FB 8E",
  329.         /* [2] */
  330.         $"04 30 40 00 0E 70 E0 00 0F F1 F0 02 0F E3 F8 03"
  331.         $"1F E7 FC 07 3F EF FE 0F 7F FF FF 1F FF FF FF BF"
  332.         $"FF FF FF FE 7F FF FF FC 01 FF FF FC 03 FF FF F8"
  333.         $"07 FF FF FC 0F FF FF FE 1F FF FF FF 0F FF FF FE"
  334.         $"07 FF FF FC 03 FF FF FC 01 FF FF FC 00 FF FF FC"
  335.         $"00 FF FF FC 00 FF FF FC 01 FF FF F8 03 EF FF F0"
  336.         $"01 C7 FC E0 00 03 F8 00 73 BF FB EE 7F BE FB EE"
  337.         $"7F BE FB EE 7F BE FB E4 7F BE FB EE 73 BE FB 8E"
  338.     }
  339. };
  340.  
  341.